﻿<div class="span10">
	<h1>Visualizar Reserva (Atividade: <?php echo $reserva->atividade; ?>)</h1>
	<?php echo Flash::render(); ?>
	
	<p><center><?php echo Html::anchor('reserva/comprovante/'.$reserva->id, 'Gerar Comprovante', array('class' => 'btn btn-primary', 'target' => '_blank')); ?></center></p>
	
	<p>Responsável: <?php echo $reserva->responsavel->nome; ?></p>
	<p>Usuário que cadastrou: <?php echo $reserva->usuario->usuario; ?></p>
	<p>Data de Cadastro: <?php echo date('d/m/Y H:i', $reserva->datacadastro); ?>h</p>
	
	<table class="table table-bordered">
	<thead>
		<tr>
			<th>Responsáveis</th>
			<th>Períodos</th>
			<th>&nbsp;</th>
			<th>Usuário</th>
		</tr>
	</thead>
	<tbody>
	<?php
		$periodos = $reserva->periodos->order_by('inicio')->find_all();
		foreach($periodos as $periodo): ?>
		<tr>
			<td><?php echo $periodo->reserva->responsavel->nome; ?></td>
			<td>
				<p>Dia: <strong><?php echo date('d/m/Y', $periodo->inicio); ?></strong></p>
				<p>Horário: <strong><?php echo date('H:i', $periodo->inicio), 'h às ', date('H:i', $periodo->fim),'h'; ?></strong></p>
				<p><?php echo Html::anchor('reserva/adicionarperiodo/'.$periodo->reserva->id,'Adicionar novo Período'); ?></p>
			</td>
			<td>&nbsp;</td>
			<td><?php echo $reserva->usuario->usuario; ?></td>
		</tr>
	<?php endforeach; ?>
	</tbody>
	</table>
	<p><center><?php echo Html::anchor('reserva/apagar/'.$reserva->id, 'Cancelar Reserva', array('class' => 'btn btn-primary')); ?></center></p>
</div>